﻿using System;
using System.Collections.Generic;
using ContractManager.Entity;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsPlanRevenueDetails
    {
        public static List<PlanRevenueDetails> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.PlanRevenueDetails.Select(db);
            }
            
        }

        public static void Insert(PlanRevenueDetails capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Insert<PlanRevenueDetails>(capital);
            }
            
        }

        public static void Update(PlanRevenueDetails capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Update<PlanRevenueDetails>(capital);
            }
            
        }

        public static PlanRevenueDetails SelectByPk(Int32 planRevDetId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<PlanRevenueDetails>(string.Format("PlanRevDetId={0}", planRevDetId));
            }
           
        }

        public static int DeleteByPk(Int32 planRevDetId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<PlanRevenueDetails>(string.Format("PlanRevDetId={0}", planRevDetId));
            }
            
        }
    }
}